package com.yc.yyds.servlet;

import com.google.gson.Gson;
import com.yc.yyds.Bean.Result;
import com.yc.yyds.dao.Userdao;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet(name = "RemoveUserServlet", value = "/RemoveUserServlet.s")
public class RemoveUserServlet extends HttpServlet {
    private Userdao dao=new Userdao();

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String userid= request.getParameter("userid");
        String flag = request.getParameter("flag");
        if("逻辑删除".equals(flag)){
            dao.remove1(userid);
        }else{
            dao.remove(userid);
        }
        String s = new Gson().toJson(new Result(1, "删除成功", null));

        response.getWriter().append(s);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
